home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Directorty Opus 5 - Magellan
/
Opus 5 - Magellan.iso
/
Archiv
/
CDDAOpus.lha
/
CDDAHandler.rexx
next >
Wrap
OS/2 REXX Batch file
|
1995-03-22
|
3KB
|
145 lines
/*rx
* CDDAHandler - a Custom Handler for ListCDDA.rexx. Processes messages from
* DOpus when the user double click's on a CustEntry.
*
* Based on LhaHandler by Geoff Seeley
*
* $VER: CDDAHandler 40.1 (25/12/94) by Laurie Lee
*
* Usage: Run >nil: <nil: RX CDDAHandler.rexx
* (from S:User-Startup)
*/
/*--------------------------------------------------------------------------*/
/* misc. variables */
DOpusPort = 'DOPUS.1'
CDDAListPort = 'CDDALIST.1'
/* need rexxsupport.library for message functions */
if ~show(l,"rexxsupport.library") then
call addlib("rexxsupport.library",0,-30,0)
/* check if we are already running */
if showlist('Ports', CDDAListPort) then do
call ExitIt
end
options results
/* open our message port */
OurPort = openport(CDDAListPort)
HandlerStatus = 'OPEN'
do until HandlerStatus = 'CLOSE'
call waitpkt(CDDAListPort)
Packet = getpkt(CDDAListPort)
if Packet ~= null() then do
Cmd = getarg(Packet, 0)
if Cmd = '1' | Cmd = '2' then do
Arg1 = getarg(Packet, 1) /* entry number */
Arg2 = getarg(Packet, 2) /* entry text */
Arg3 = getarg(Packet, 3) /* userdata */
call reply(Packet, 0)
address value DOpusPort
Busy on
if Cmd = '1' then
call HandleDoubleClick
Busy off
end
else
call reply(Packet, 0)
if Cmd = 'CLOSE' then
HandlerStatus = 'CLOSE'
end
end
/* close up shop */
call closeport(OurPort)
exit
/*--------------------------------------------------------------------------*/
HandleDoubleClick: /* double click, view file */
/* re-select this entry (double click unselects) */
TrackNumber = ''
TrackNumber = substr(ARG2,1,3);
address YACDP
res=0;
select
when ~compare(ARG2,"Previous") then do
lastsong
if RC > 0 then do
res=RC
end
end
when ~compare(ARG2,"Eject") then do
eject
if RC > 0 then do
res=RC
end
end
when ~compare(ARG2,"Stop") then do
stop
if RC > 0 then do
res=RC
end
end
when ~compare(ARG2,"Pause") then do
pause
if RC > 0 then do
res=RC
end
end
when ~compare(ARG2,"Next") then do
nextsong
if RC > 0 then do
res=RC
end
end
otherwise do
playtrack TrackNumber
if RC > 0 then do
res=RC
end
end
end
address DOPUS.1
select
when res=10 then do
Notify "YACDP reports an\fatal error"
end
when res=15 then do
Notify "YACDP reports a SCSI error\Probably disk removed"
end
when res=20 then do
Notify "YACDP reports a terminal error\and has quit"
end
otherwise do
nop
end
end
return
ExitIt:
exit
return